#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
/**
 * @brief
 * n == nums.length
1 <= nums.length <= 105
-109 <= nums[i] <= 109
The answer is guaranteed to fit in a 32-bit integer.
 */
class Solution
{
public:
    int minMoves(vector<int> &nums)
    {
        int minNum = *min_element(nums.begin(), nums.end());
        int res = 0;
        for (int num : nums)
        {
            res += num - minNum;
        }
        return res;
    }
};
int main()
{
    Solution s;
    vector<int> nums = {1, 2, 3, 4, 5};
    cout << s.minMoves(nums) << endl;
    system("pause");
    return 0;
}
